﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QuanLyCuaHangBanMayTinh.He_Thong_Du_Lieu;
using QuanLyCuaHangBanMayTinh.He_Thong_Xu_Ly;
using QuanLyCuaHangBanMayTinh.He_Thong_Giao_Dien;

namespace QuanLyCuaHangBanMayTinh
{
    public partial class frmXuatHang : Form
    {
        public frmXuatHang()
        {
            InitializeComponent();
        }

        public void HienThiDanhSach()
        {
            dgvXuatHang.DataSource = XuatHangDAO.SelectmhAll();
        }

        private void btThoat_Click(object sender, EventArgs e)
        {

        }

        private void frmXuatHang_Load(object sender, EventArgs e)
        {
            HienThiDanhSach();
        }

        private void btThem_Click(object sender, EventArgs e)
        {
            XuatHangDTO mh = new XuatHangDTO();
            mh.TenMatHang = textMatHang.Text;
            mh.TenKhachHang = textTenKhachHang.Text;
            mh.NhanVienNhap = textNhanVienNhap.Text;
            mh.NgayLapPhieu = textNgayLapPhieu.Text;
            mh.DonViTinh = textDonViTinh.Text;
            mh.SoLuong = textSoLuong.Text;
            mh.DonGia = textDonGia.Text;
            mh.ThanhTien = textThanhTien.Text;
            if (XuatHangBUS.ThemMatHang(mh) == false)
            {
                MessageBox.Show("Đã tồn tại trong CSDL");
            }
            else
            {
                MessageBox.Show("Đã thêm thành công");
            }
        }
    }
}
